namespace Study403 {



  type MessageOf<T> = T extends { message: unknown } ? T["message"] : never;

  type Email = { message: string; from: string };
  type SMS = { message: number; phoneNumber: string };
  type Chat = { content: string };

  type EmailMessageContents = MessageOf<Email>; // string
  type SMSMessageContents = MessageOf<SMS>; // string
  type ChatMessageContents = MessageOf<Chat>; // never




  // 运行时
  let person = {
    name: "Alice",
    age: 30
  };

  console.log("name" in person); // true
  console.log("gender" in person); // false


}